﻿#pragma once

// 蛇身类型
typedef enum SnakeBodyType {
    APPLE,  // 果子
    SNAKE   // 蛇
} SnakeBodyType;

typedef struct SnakeBody SnakeBody;

typedef void (*SnakeBodyDelete)(SnakeBody**);
typedef void (*SnakeBodyDraw)(SnakeBody*);
typedef void (*SnakeBodyErase)(SnakeBody*);
typedef void (*SnakeBodySetType)(SnakeBody*, SnakeBodyType);

// 蛇身
struct SnakeBody  {
    HBRUSH mBrush;      // 画刷
    HDC mDrawer;        // 绘图者
    SnakeBody* mNext;   // 下一个蛇身
    POINT mPosition;    // 位置

    SnakeBodyDelete deleteSelf;
    SnakeBodyDraw draw;
    SnakeBodyErase erase;
    SnakeBodySetType setType;
};

SnakeBody* New_SnakeBody(HDC, POINT, SnakeBodyType);
